//
//  ViewController.m
//  AlertViewByXQ
//
//  Created by  Mac on 2017/8/29.
//  Copyright © 2017年  Mac. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"实现alertView功能";
    
    
    UIButton * button = [UIButton buttonWithType:(UIButtonTypeCustom)];
    button.frame = CGRectMake(10, 65, 120, 40);
//    button.backgroundColor = [UIColor whiteColor];
    button.layer.borderWidth = 1;
    button.layer.masksToBounds = YES;
    button.layer.borderColor = [UIColor blueColor].CGColor;
    
    button.layer.cornerRadius = 5;
    [button setTitle:@"点  击" forState:(UIControlStateNormal)];
    [button setTitleColor:[UIColor blueColor] forState:(UIControlStateNormal)];
    [button addTarget:self action:@selector(clickBtnFunction) forControlEvents:(UIControlEventTouchUpInside)];
    [button setTitleColor:[UIColor lightGrayColor] forState:(UIControlStateHighlighted)];
    [self.view addSubview:button];
    

    

    
}

-(void)clickBtnFunction
{
    NSString * describtion =
    @"描述";
    
    AlertView *alertView = [[AlertView alloc]initWithTitle:@"title" andMessage:describtion] ;
    alertView.titleCol = [UIColor colorWithHexString:@"333333"];
    alertView.messageColor = [UIColor colorWithHexString:@"666666"];
    alertView.titleFont = [UIFont systemFontOfSize:15];
    alertView.messageFont = [UIFont systemFontOfSize:13];
    alertView.messageIsAlignLeft = NO;
    alertView.messageNeedLineSpace = YES;
    
    [alertView loadCustomView:[self promptView]];
//    WS(weakSelf);
    [alertView addButtonWithTitle:@"保留" type:CustomAlertViewButtonTypeDefault handler:^(AlertView *alertView) {
    }];
    
    [alertView addButtonWithTitle:@"删除" type:CustomAlertViewButtonTypeCancel handler:^(AlertView *alertView) {
        [alertView dismissAnimated:NO];
//        [self deleteRequest:dict[@"id"] index:indexPath.row];
    }];
    [alertView show];

}

-(UIView *)promptView{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 52, 72)];
    UIImageView *imgview =  [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_renzheng_mark"]];
    
    imgview.frame = CGRectMake(0, 20, 52, 52);
    [view addSubview:imgview];
    return view;
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
